//
//  SPIdeaViewController.m
//  Sport
//
//  Created by Cass on 2017/12/2.
//  Copyright © 2017年 Cass. All rights reserved.
//

#import "SPIdeaViewController.h"

@interface SPIdeaViewController ()<UITextViewDelegate>
@property (weak, nonatomic) IBOutlet UITextView *textView;
@property (weak, nonatomic) IBOutlet UIButton *submitBtn;
@property (nonatomic, weak) UILabel *label;
@end

@implementation SPIdeaViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.textView.delegate = self;
    [self configBasic];
    
}

- (void)configBasic{
    [self.submitBtn.layer setBorderColor:[UIColor grayColor].CGColor];
    self.submitBtn.layer.cornerRadius = 10;
    self.submitBtn.layer.borderWidth = 1;
    //超过子图层的部分剪裁掉
    //    self.submitBtn.layer.masksToBounds = YES;
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(5, 5, 130, 21)];
    label.textColor = [UIColor grayColor];
    label.text = @"请输入您的意见";
    [self.textView addSubview:label];
    self.label = label;
}

#pragma mark - UITextViewDelegate -
- (void)textViewDidChange:(UITextView *)textView{
    if (textView.text.length > 0) {
        self.label.hidden = YES;
    }else{
        self.label.hidden = NO;
    }
}
- (IBAction)submitClick:(id)sender {
    [SPHUDUtil showHUDWithDismissTimeInterval:1 message:@"提交成功，谢谢您的意见！" hudType:SPHUDTypeSuccess];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.textView resignFirstResponder];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
   
}



@end
